package enumclass;

/**
 * @author: wuhao
 * @since: 2021/5/4 17:14
 * 自定义枚举类
 */
public class CustomEnum {

    /**
     * 1.私有化类的构造器,保证不能在类的外部创建其对象;
     * 2.在类的内部创建枚举类的实例,声明为:public static final;
     * 3.对象如果有实例变量,应该声明为private final,并在构造器中初始化;
     */
    public static void main(String[] args) {
        System.out.println(Season.SPRING);

    }
}
class Season{
    //3.对象如果有实例变量,应该声明为private final,并在构造器中初始化;
    private final String SEASONNAME;//季节的名称
    private final String SEASONDESC;//季节的描述

    //1.私有化类的构造器,保证不能在类的外部创建其对象;
    private Season(String seasonName,String seasonDesc){
        this.SEASONNAME = seasonName;
        this.SEASONDESC = seasonDesc;
    }
    //2.在类的内部创建枚举类的实例,声明为:public static final;
    public static final Season SPRING = new Season("春天", "春暖花开");
    public static final Season SUMMER = new Season("夏天", "夏日炎炎");
    public static final Season AUTUMN = new Season("秋天", "秋高气爽");
    public static final Season WINTER = new Season("冬天", "白雪皑皑");

    @Override
    public String toString() {
        return "Season{" +
                "SEASONNAME='" + SEASONNAME + '\'' +
                ", SEASONDESC='" + SEASONDESC + '\'' +
                '}';
    }
}